﻿using KingsSharp.Common.Data;
using KingsSharp.Core;
using CRM.Admin.Contracts.Dto.Sys;
using CRM.Admin.Contracts.Model.Sys;
using System;
using System.Linq;


namespace CRM.Admin.Contracts.Contract.Sys
{
    public interface IMenuService : IDependency
    {
        /// <summary>
        /// 初始化系统菜单
        /// </summary>
        /// <param name="catalogdto">菜单目录dto信息</param>
        /// <param name="menunodedto">菜单dto信息</param>
        /// <returns></returns>
        OperationResult InitEco(MenuCatalog catalogdto);

        #region 菜单目录
        /// <summary>
        /// 获取 菜单目录信息
        /// </summary>
        IQueryable<MenuCatalog> MenuCatalogs { get; }


        /// <summary>
        /// 添加菜单目录
        /// </summary>
        /// <param name="dtos">包含添加信息的菜单目录信息</param>
        /// <returns></returns>
        OperationResult AddMenuCatalog(params MenuCatalogDto[] dtos);

        /// <summary>
        /// 更新菜单目录信息
        /// </summary>
        /// <param name="dtos">包含添加信息的菜单目录信息</param>
        /// <returns></returns>
        OperationResult EditMenuCatalog(params MenuCatalogDto[] dtos);

        /// <summary>
        /// 删除目录
        /// </summary>
        /// <param name="ids">要删除的目录编号</param>
        /// <returns>业务操作结果</returns>
        OperationResult DeleteMenuCatalogs(params Guid[] ids);
        #endregion


        #region 菜单信息
        /// <summary>
        /// 菜单信息集合
        /// </summary>
        IQueryable<MenuNode> MenuNodes { get; }

        /// <summary>
        /// 检测菜单编码是否存在
        /// </summary>
        /// <param name="menucode"></param>
        /// <returns></returns>
        bool CheckNodeExists(string menucode);

        /// <summary>
        /// 添加菜单信息
        /// </summary>
        /// <param name="dtos">包含添加信息的菜单信息</param>
        /// <returns></returns>
        OperationResult AddMenuNode(params MenuNodeDto[] dtos);

        /// <summary>
        /// 更新菜单信息
        /// </summary>
        /// <param name="dtos">包含添加信息的菜单信息</param>
        /// <returns></returns>
        OperationResult EditMenuNode(params MenuNodeDto[] dtos);

        /// <summary>
        /// 删除菜单信息
        /// </summary>
        /// <param name="ids">要删除的菜单编号</param>
        /// <returns>业务操作结果</returns>
        OperationResult DeleteMenuNodes(params Guid[] ids);
        #endregion

        #region 菜单的功能权限
        /// <summary>
        /// 菜单功能信息集合
        /// </summary>
        IQueryable<MenuNodeAction> MenuNodeActions { get; }
        #endregion

    }
}
